
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height"/>
    <title>测试页</title>
    <script src="http://www.linkdood.cn/jssdk/url/vrv-jssdk.js"></script>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <style>
        div {
            margin: 5px 0;
        }
    </style>
</head>
<body>
<input type="button" onclick="hiddleNav()" value="隐藏导航">
<br/>
<input type="button" onclick="showNav()" value="显示导航">
<br/>
<input type="button" onclick="getClientLang()" value="获取客户端语言">
<div id="divLanguage"></div>
<input type="button" onclick="getVersionMark()" value="获取mark">
<div id="divMark"></div>
<input type="button" onclick="getInfoWithSweep()" value="扫描二维码">
<div id="divInfoWithSweep"></div>
<input type="button" onclick="getLocalFiles()" value="获取本地文件并上传">
<div id="divgetLocalFiles"></div>
<input type="button" onclick="getLocalPhotos()" value="选择本地图片并上传">
<div id="divgetLocalPhotos"></div>
<input type="button" onclick="getGroupList()" value="获取用户群信息">
<div id="divgetGroupList"></div>
<input type="button" onclick="getOrganization()" value="获取组织机构信息">
<div id="divgetOrganization"></div>
<input type="button" onclick="getContactList()" value="获取用户好友信息">
<div id="divgetContactList"></div>
<input type="button" onclick="getPosition()" value="获取位置信息">
<div id="divgetPosition"></div>
<input type="button" onclick="getAccountInfo()" value="获取用户信息">
<div id="divgetAccountInfo"></div>
<input type="button" onclick="takePhoto()" value="调用摄像头拍照">
<div id="divtakePhoto"></div>

<script type="text/javascript">
    vrv.init({
        debug: true
    });
    vrv.ready(function () {
        $('body').append("<div>文档加载...</div>");
        $('body').append("<div>文档加载完</div>");
    });
    function hiddleNav() {
        vrv.jssdk.showNavigationBar({
            show: false
        })
    }
    function showNav() {
        vrv.jssdk.showNavigationBar({
            show: true
        })
    }
    function getClientLang() {
        vrv.jssdk.getLanguage({
            success: function (res) {
                $('#divLanguage').append("语言：" + res.language);
            }
        })
    }
    function getVersionMark() {
        try {
            vrv.jssdk.getVersionMark({
                success: function (res) {
                    $('#divMark').append("获取mark：" + res.mark);
                }
            })
        } catch (e) {
            $('#divMark').append(e);
        }
    }
    function getInfoWithSweep() {
        vrv.jssdk.getInfoWithSweep({
            success: function (res) {
                $('#divInfoWithSweep').append(res.sweepKey);
            }
        })
    }
    function getLocalFiles() {
        vrv.jssdk.getLocalFiles({
            size: 5,//最多选择文件的个数，最大值 10，可为空，默认 10
            success: function (res) {
                for (var i in res.mFilePath) {
                    $('#divgetLocalFiles').append("<div>" + res.mFilePath[i] + "</div>");
                }
            }
        })
    }
    function getLocalPhotos() {
        vrv.jssdk.getLocalPhotos({
            size: 5,//最多选择文件的个数，最大值 10，可为空，默认 10
            success: function (res) {
                for (var i in res.mPhotoPath) {
                    $('#divgetLocalPhotos').append("<div>" + res.mPhotoPath[i] + "</div>");
                }
            }
        })
    }
    function getGroupList() {
        vrv.jssdk.getGroupList({
            success: function (res) {
                for (var i in res.groupsInfo) {
                    $('#divgetGroupList').append("<div>" + res.groupsInfo[i].groupName + "</div>");
                }
            }
        })
    }
    function getOrganization() {
        try {
            vrv.jssdk.getOrganization({
                orgId: 11,
                success: function (res) {
                    for (var i in res.organization) {
                        $('#divgetOrganization').append("<div>" + res.organization[i].orgName + "</div>");
                    }
                }
            });
        } catch (e) {
            alert(e);
        }
    }
    function getContactList() {
        vrv.jssdk.getContactList({
            success: function (res) {
                $('#divgetContactList').append("[");
                for (var i in res.contacts) {
                    $('#divgetContactList').append("<div>{userID: '" + res.contacts[i].buddyID + "',userName: '" + res.contacts[i].buddyName + "', userPhotoUrl: '" + res.contacts[i].portraitURL + "'},</div>")
                }
                $('#divgetContactList').append("]");
            }
        })
    }
    function getPosition() {
        vrv.jssdk.getPosition({
            success: function (res) {
                $('#divgetPosition').append("<div>" + res.mAddress + "</div>");
            }
        })
    }
    function getAccountInfo() {
        vrv.jssdk.getAccountInfo({
            success: function (res) {
                $('#divgetAccountInfo').append("<div>" + res.mUserName+"#"+res.mUserId + "</div>");
            }
        })
    }
    function takePhoto() {
        vrv.jssdk.takePhoto({
            success: function (res) {
                $('#divtakePhoto').append("<div>" + res.mPhotoPath + "</div>");
            }
        })
    }
</script>
</body>
</html>
